<template>
  <div>
    <!-- q全局组件：商品分类 -->
    <TypeNav></TypeNav>
    <ListContainer></ListContainer>
    <Recommend></Recommend>
    <Rank></Rank>
    <Like></Like>
    <!-- floor使用v-for遍历生成 -->
    <!-- 父子组件通信props -->
    <Floor v-for="(floor,index) in floorList" :key="floor.id" :floor="floor" ></Floor>
    <Brand></Brand>
  </div>
</template>

<script>
// 局部组件：引入  注册 使用
import ListContainer from "./listContainer";
import Recommend from "./recommend";
import Rank from "./rank";
import Like from "./like";
import Floor from "./floor";
import Brand from "./brand";
import { mapState } from 'vuex';

export default {
  name: "Home",
  components: {
    ListContainer,
    Recommend,
    Rank,
    Like,
    Floor,
    Brand,
  },
  mounted(){
   this.$store.dispatch('getFloorList')


  },
  computed:{
    ...mapState({
      floorList:state=>state.home.floorList
    })
  }
};
</script>

<style>
</style>